<%@page import="cn.sendto.mapper.IRowMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@page import="cn.sendto.mapper.*" %>
<%@page import="cn.sendto.model.*" %>
<%@page import="java.util.List" %>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
   if(request.getSession().getAttribute("user")==null){
	   request.getRequestDispatcher("login.jsp").forward(request, response);
   }

%>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="css/global.css"/>
		<title>修改成绩</title>
		<link rel="stylesheet" href="css/main.css" />
       <title></title>
      </head>
	<body class="add">
		<div class="add_div">
			<form action="update_score.jsp" method="post">
			<%
			   request.setCharacterEncoding("UTF-8");
			
			   String id = request.getParameter("id");
			   DBHelper helper=new DBHelper();
			   IRowMapper mapper=new ScoreMapper();
			   String query="SELECT scoreinfo.*,studentinfo.studentname,courseinfo.coursename "
					   +"FROM scoreinfo,studentinfo,courseinfo "
					   +"WHERE scoreinfo.studentid=studentinfo.studentid "
					   +"AND scoreinfo.courseid=courseinfo.courseid AND scoreinfo.scoreid=?";
			   
			   List<ScoreEntity> list= helper.executeQuery(query, mapper, id);
			   helper.close();
			%>
			    <div class="add_item">
					<span>课程名称：</span>
					<input type="text" readonly="readonly" value="<%=list.get(0).getCourseName()%>"/>
				</div>
				
				<div class="add_item">
					<span>学生姓名：</span>
					<input type="text" readonly="readonly" name="studentname" value="<%=list.get(0).getStudentName()%>"/>
				</div>
				<input type="hidden" name="scoreid" value="<%=id%>"/>
				<div class="add_item">
					<span>课程成绩：</span>
					<input type="text" name="score" value="<%=list.get(0).getScore()%>"/>
				</div>

				<div class="btn">
					<input  type="submit" value="提交"/>
				</div>
			</form>
		</div>
	</body>
</html>